home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / ARCHIVE / AFE11.ZIP;1 / AFE.CMD next >
Encoding:
Text File  |  1993-09-06  |  15.0 KB  |  637 lines

  1. /* AFE.CMD version 1.1 */
  2. /* Created 6 September 1993 by H. M. Weiner */
  3.  
  4. arg arcfile
  5.  
  6. /* ---------------------------------------------------------------- */
  7.  
  8. WORKDIR = 'd:\$temp'      /* Variables Definitions: See VARS.TXT */
  9. WORKDRIVE = 'd:'
  10. FILESDIRNAME = 'TEMP dir'
  11. PICKDIR = 'd:\temp'
  12. UNARCDIR = 'd:\temp'
  13. ARCDIR = 'd:\dlf'
  14. UNZIPPER = 'unzip -oj'
  15. ZIPPER = 'zip -oj9'
  16. UNLZHER = 'lh2 x'
  17. LZHER = 'lh2 a'
  18. SCANRPT = 'd:\dlf\arcscan.rpt'
  19. SCANNER = 'd:\ref\scan 'workdir'/A/BELL/NOPAUSE/REPORT 'SCANRPT''
  20. CHIRP = y
  21.  
  22. /* ---------------------------------------------------------------- */
  23. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  24. call SysLoadFuncs
  25. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  26. initcode = VInit()
  27. if initcode = 'ERROR' then exit
  28. signal on failure name CLEANUP
  29. signal on halt name CLEANUP
  30. signal on syntax name CLEANUP
  31. select
  32. when arcfile <> '' then signal arcarg
  33. otherwise signal go
  34. end
  35.  
  36. go:
  37.  
  38. drop argstart fileext ziplzh action arcname arcfile archname
  39. NewDirectory = directory(''workdrive'\')
  40. if Stream(''workdir'\*', 'c', 'query exists') <>'' then do
  41. call SysFileTree ''workdir'\*', 'files', 'fo'
  42. do i = 1 to files.0
  43. call sysfiledelete(files.i)
  44. end
  45. end
  46. call sysrmdir(''workdir'')
  47. call VDialogPos 50, 35
  48. list.vstring = 0
  49. list.0 = 6
  50. list.1 = View an Archive
  51. list.2 = Virus Scan Archive
  52. list.3 = Print Archived File
  53. list.4 = Unarchive a File
  54. list.5 = Make or Update LZH
  55. list.6 = Make or Update ZIP
  56. call VRadioBox  'ˇˇArchive Front End v1.1 ', list,3
  57. selection = list.vstring
  58. if selection = Virus Scan Archive then signal virus
  59. if selection = View an Archive then do
  60. action = view
  61. signal view
  62. end
  63. if selection = Print Archived File then do
  64. action = print
  65. signal view
  66. end
  67. if selection = Unarchive a File then signal unarc
  68. if selection = Make or Update LZH then signal LZHarc
  69. if selection = Make or Update ZIP then signal ZIParc
  70. signal CLEANUP
  71.  
  72. view:
  73.  
  74. call VDialogPos 50, 40
  75. button =  VFileBox('Pick an Archive to open...', ''ARCdir'\*.*', 'file')
  76. if button = 'CANCEL'  then signal go
  77. else
  78. arcfile = file.vstring
  79. fileext = right(''arcfile'',3)
  80. parse upper var fileext fileext
  81. if fileext = 'ZIP' then signal go_view
  82. if fileext = 'LZH' then signal go_view
  83. else signal notarc
  84.  
  85. go_view:
  86.  
  87. call openmsg
  88. call SysMkDir ''workdir''
  89. 'xcopy 'arcfile' 'workdir''
  90. Newdirectory = directory(''workdir'')
  91. call SysFileTree ''workdir'\*.zip', 'zipcount'
  92. if zipcount.0 = 0 then signal lzhview
  93. else
  94. 'del *.zip'
  95. ''UNZIPPER' 'arcfile''
  96. call vclosewindow id
  97. call check4mor
  98. signal zipdone
  99. lzhview:
  100. 'del *.lzh'
  101. ''UNLZHER' 'arcfile''
  102. call vclosewindow id
  103. call check4mor
  104.  
  105. zipdone:
  106.  
  107. button = VFileBox('Pick a File to 'action'...', ''workdir'\*.*', 'file')
  108. if button = 'CANCEL' then do
  109. signal argchoice
  110. end
  111. else
  112. filename = file.vstring
  113. NewDirectory = directory(''workdrive'\')
  114. if action = print then signal printfile
  115. else
  116. 'start e 'filename''
  117. drop action
  118. signal argchoice
  119.  
  120. virus:
  121.  
  122. call VDialogPos 50, 40
  123. button =  VFileBox('Pick an Archive to Scan...', ''ARCdir'\*.*', 'file')
  124. if button = 'CANCEL'  then signal go
  125. else
  126. arcfile = file.vstring
  127. ARCNAME = filespec('n',''arcfile'')
  128. fileext = right(''arcfile'',3)
  129. parse upper var fileext fileext
  130. if fileext = 'ZIP' then signal go_scan
  131. if fileext = 'LZH' then signal go_scan
  132. else signal notarc
  133.  
  134. go_scan:
  135.  
  136. call openmsg
  137. call SysMkDir ''workdir''
  138. 'xcopy 'arcfile' 'workdir''
  139. NewDirectory = directory(''workdir'')
  140. call SysFileTree ''workdir'\*.zip', 'zipcount'
  141. if zipcount.0 = 0 then signal lzhscan
  142. else
  143. 'del *.zip'
  144. ''UNZIPPER' 'arcfile''
  145. call vclosewindow id
  146. call check4mor
  147. signal scanem
  148. lzhscan:
  149. 'del *.lzh'
  150. ''UNLZHER' 'arcfile''
  151. call vclosewindow id
  152. call check4mor
  153.  
  154. scanem:
  155.  
  156. SCANNER
  157. if rc = 1 then do
  158. do 15
  159. call beep 1000,50
  160. end
  161. NewDirectory = directory(''workdrive'\')
  162. 'start e 'SCANRPT''
  163. signal cleanup
  164. end
  165. else do
  166. call VDialogPos 50, 35
  167. if chirp = y then call beep 2000,15
  168. msg.0 = 1
  169. msg.1 = '                 ˚ No Viruses found in 'ARCNAME' ˚ '
  170. call VMsgBox '                                 GOOD NEWS !', msg, 1
  171. call SysFileDelete(''scanrpt'')
  172. end
  173. signal argchoice
  174.  
  175. unarc:
  176.  
  177. call VDialogPos 50, 40
  178. button =  VFileBox('Pick a File to UnArchive...', ''ARCdir'\*.*', 'file')
  179. if button = 'CANCEL'  then signal go
  180. else
  181. arcfile = file.vstring
  182. fileext = right(''arcfile'',3)
  183. parse upper var fileext fileext
  184. if fileext = 'ZIP' then signal go_un
  185. if fileext = 'LZH' then signal go_un
  186. else signal notarc
  187.  
  188. go_un:
  189.  
  190. call openmsg
  191. call SysMkDir ''workdir''
  192. 'xcopy 'arcfile' 'workdir''
  193. Newdirectory = directory(''workdir'')
  194. call SysFileTree ''workdir'\*.zip', 'zipcount'
  195. if zipcount.0 = 0 then signal lzhun
  196. else
  197. 'del *.zip'
  198. ''UNZIPPER' 'arcfile''
  199. call vclosewindow id
  200. call check4mor
  201. signal unarcact
  202. lzhun:
  203. 'del *.lzh'
  204. ''UNLZHER' 'arcfile''
  205. call vclosewindow id
  206. call check4mor
  207.  
  208. unarcact:
  209.  
  210. ARCNAME = filespec('n',''arcfile'')
  211. call VDialogPos 50, 35
  212. list.0 = 2
  213. list.1 = All Files
  214. list.2 = Select Files
  215. call VRadioBox  'Extract  'ARCNAME'', list,3
  216. selection = list.vstring
  217. if selection = All Files then do
  218. 'xcopy * 'UNARCdir''
  219. signal go
  220. end
  221. if selection = Select Files then signal pickmore
  222. else
  223. signal go
  224.  
  225. pickmore:
  226.  
  227. call VDialogPos 50,40
  228. button = VFileBox('File to Extract, Cancel After All Files Have Been Selected...', ''workdir'\*.*', 'file')
  229. if button = 'CANCEL' then signal go
  230. else
  231. filename = file.vstring
  232. 'xcopy 'filename' 'UNARCdir''
  233. signal pickmore
  234.  
  235. arcarg:
  236.  
  237. call openmsg
  238. fileext = right(''arcfile'',3)
  239. parse upper var fileext fileext
  240. if fileext = 'ZIP' then do
  241. ziplzh = pickzip
  242. signal go_arg
  243. end
  244. if fileext = 'LZH' then do
  245. ziplzh = picklzh
  246. signal go_arg
  247. end
  248. else signal notarc
  249.  
  250. go_arg:
  251.  
  252. call SysMkDir ''workdir''
  253. 'xcopy 'arcfile' 'workdir''
  254. Newdirectory = directory(''workdir'')
  255. if ziplzh = picklzh then signal lzhun2
  256. else
  257. 'del *.zip'
  258. ''UNZIPPER' 'arcfile''
  259. call vclosewindow id
  260. call check4mor
  261. signal argchoice
  262. lzhun2:
  263. 'del *.lzh'
  264. ''UNLZHER' 'arcfile''
  265. call vclosewindow id
  266. call check4mor
  267.  
  268. argchoice:
  269.  
  270. argstart = on
  271. call SysFileTree ''arcfile'',date,t
  272. datetime = date.1
  273. filedate = left(datetime,8)
  274. ARCNAME = filespec('n',''arcfile'')
  275. fileext = right(''arcfile'',3)
  276. parse upper var fileext fileext
  277. if fileext = 'ZIP' then ziplzh = pickzip
  278. if fileext = 'LZH' then ziplzh = picklzh
  279. NewDirectory = directory(''workdir'')
  280. call VDialogPos 50, 35
  281. list.vstring = 0
  282. list.0 = 5
  283. list.1 = View a File
  284. list.2 = Print a File
  285. list.3 = Virus Scan Archive
  286. list.4 = Extract a File
  287. list.5 = Add to this Archive
  288. call VRadioBox  ''Arcname'' ''filedate'', list,3
  289. selection = list.vstring
  290. if selection = Virus Scan Archive then signal scanem
  291. if selection = View a File then do
  292. action = view
  293. signal zipdone
  294. end
  295. if selection = Print a File then do
  296. action = print
  297. signal zipdone
  298. end
  299. if selection = Extract a File then signal unarcact
  300. if selection = Add to this Archive then signal arcex
  301. else
  302. signal go
  303.  
  304. check4mor:
  305.  
  306. Call SysFileTree ''workdir'\*.zip', 'count'
  307. if count.0 > 0 then signal morezip
  308. else
  309.  
  310. check4morL:
  311.  
  312. Call SysFileTree ''workdir'\*.lzh', 'count'
  313. if count.0 > 0 then signal morelzh
  314. else return
  315.  
  316. morezip:
  317.  
  318. call VDialogPos 50, 35
  319. if chirp = y then call beep 2000,15
  320. msg.0 = 2
  321. msg.1 = '                ZIPfiles exist within your archive !'
  322. msg.2 = '                       Press Okay to continue...'
  323. call VMsgBox '                               ! ATTENTION !', msg, 1
  324. call VDialogPos 50,40
  325. button = VFileBox('ZIP to UnArchive, Cancel After All Files Have Been Selected...', ''workdir'\*.zip', 'file')
  326. if button = 'CANCEL' then signal check4morL
  327. else
  328. filename = file.vstring
  329. ''UNZIPPER' 'filename''
  330. 'del 'filename''
  331. signal check4mor
  332.  
  333. morelzh:
  334.  
  335. call VDialogPos 50, 35
  336. if chirp = y then call beep 2000,15
  337. msg.0 = 2
  338. msg.1 = '                LZHfiles exist within your archive !'
  339. msg.2 = '                       Press okay to continue...'
  340. call VMsgBox '', msg, 1
  341. call VDialogPos 50,40
  342. button = VFileBox('LZH to UnArchive, Cancel After All Files Have Been Selected...', ''workdir'\*.lzh', 'file')
  343. if button = 'CANCEL' then return
  344. else
  345. filename = file.vstring
  346. ''UNLZHER' 'filename''
  347. 'del 'filename''
  348. signal check4mor
  349.  
  350. LZHarc:
  351.  
  352. ZIPLHZ = pickLZH
  353. signal DOarc
  354.  
  355. ZIParc:
  356.  
  357. ZIPLZH = pickZIP
  358.  
  359. DOarc:
  360.  
  361. list.0 = 2
  362. list.1 = Create New Archive
  363. list.2 = Update Existing
  364. call VRadioBox  'New or Update', list,3
  365. selection = list.vstring
  366. if selection = Update Existing then signal arcex
  367. if selection = Create New Archive then signal makenew
  368. else do
  369. signal go
  370. end
  371.  
  372. makenew:
  373.  
  374. prompt.0 = 1
  375. prompt.1 = 'ˇˇˇ[[without the extension]]'
  376. prompt.vstring = ''
  377. button = VInputBox('Enter the Archive Name :', prompt, 10, 3)
  378. ARCHname = prompt.vstring
  379. if button = cancel then signal go
  380. arcfileext = right(ziplzh,3)
  381. if Stream(''arcdir'\'archname'.'arcfileext'','C', 'Query Exists') <>'' then do
  382. if chirp = y then call beep 2000,15
  383. parse upper var archname archname2
  384. msg.0 = 3
  385. msg.1 = '                   'archname2'.'arcfileext' already exists in 'arcdir' !'
  386. msg.2 = '                            Press OK to Overwrite...'
  387. msg.3 = '                  Press Cancel to Input a New Name...'
  388. overwritebutton = VMsgBox('WARNING:  " 'arcdir'\'archname2'.'arcfileext' "  will be destroyed !',msg, 3)
  389. if overwritebutton = cancel then signal makenew
  390. call SysFileDelete (''arcdir'\'archname'.'arcfileext'')
  391. end
  392. else
  393. if archname = '' then do
  394. if chirp = y then call beep 2000,15
  395. msg.0 = 3
  396. msg.1 = '                     You did not input an Archive Name !'
  397. msg.2 = '                               Press Okay to try again...'
  398. msg.3 = '                               Press Cancel to Abort...'
  399. namebutton = VMsgBox('                       ERROR !   ERROR !   ERROR !', msg, 3)
  400. if namebutton = cancel then signal go
  401. if namebutton = ok then signal makenew
  402. signal go
  403. end
  404. else
  405. list.0 = 2
  406. list.1 = All Files in FILESdirname
  407. list.2 = Selected Files
  408. call VRadioBox  'Which Files ?', list,3
  409. selection = list.vstring
  410. if selection = Selected Files then signal pickmorz
  411. if selection = All Files in FILESdirname then signal allnew
  412. else signal go
  413.  
  414. allnew:
  415.  
  416. if Stream(''pickdir'\*','C', 'Query Exists') = '' then signal nofiles
  417. call zipupmsg
  418. NewDirectory = directory(''ARCdir'')
  419. if ziplzh = pickzip then do
  420. ''ZIPPER' 'ARCHname'.ZIP 'PICKdir'\*'
  421. call vclosewindow id
  422. signal go
  423. end
  424. else do
  425. ''LZHER' 'ARCHname'.LZH 'PICKdir'\*'
  426. call vclosewindow id
  427. signal go
  428. end
  429. else
  430. signal go
  431. end
  432.  
  433. pickmorz:
  434.  
  435. call VDialogPos 50,40
  436. button = VFileBox('File to Include, Cancel After All Files Have Been Selected...', ''PICKdir'\*.*', 'file')
  437. if button = 'CANCEL' then signal ARCup
  438. else
  439. filename = file.vstring
  440. call SysMkDir ''workdir''
  441. 'xcopy 'filename' 'workdir''
  442. signal pickmorz
  443.  
  444. ARCup:
  445.  
  446. if Stream(''workdir'\*','C', 'Query Exists') = '' then signal go
  447. call zipupmsg
  448. NewDirectory = directory(''ARCdir'')
  449. if ZIPLZH = pickzip then do
  450. ''ZIPPER' 'ARCHname'.ZIP 'workdir'\*'
  451. call vclosewindow id
  452. signal go
  453. end
  454. else do
  455. ''LZHER' 'ARCHname'.LZH 'workdir'\*'
  456. call vclosewindow id
  457. signal go
  458. end
  459.  
  460. arcex:
  461.  
  462. if argstart = on then signal argadd
  463. else
  464. call VDialogPos 50,40
  465. button = VFileBox('       Archive file to Update...', ''ARCdir'\*.*', 'file')
  466. if button = 'CANCEL' then do
  467. signal go
  468. end
  469. else
  470. arcfile = file.vstring
  471. if ZIPLZH = pickzip then do
  472. fileext = right(''arcfile'',3)
  473. parse upper var fileext fileext
  474. if fileext <> 'ZIP' then signal notziplzh
  475. else signal argadd
  476. end
  477. else do
  478. fileext = right(''arcfile'',3)
  479. parse upper var fileext fileext
  480. if fileext <> 'LZH' then signal notziplzh
  481. else signal argadd
  482. end
  483. else
  484.  
  485. argadd:
  486.  
  487. call VDialogPos 50, 35
  488. list.0 = 2
  489. list.1 = All Files in FILESdirname
  490. list.2 = Selected Files
  491. call VRadioBox  'Which Files ?', list,3
  492. selection = list.vstring
  493. if selection = Selected Files then signal pickmorez
  494. if selection = All Files in Filesdirname then signal arcupall
  495. else signal go
  496. end
  497.  
  498. arcupall:
  499.  
  500. if Stream(''pickdir'\*','C', 'Query Exists') = '' then signal nofiles
  501. call zipupexmsg
  502. if ziplzh = pickzip then do
  503. ''ZIPPER' 'arcfile' 'PICKdir'\*'
  504. call vclosewindow id
  505. signal go
  506. end
  507. else
  508. ''LZHER' 'arcfile' 'PICKdir'\*'
  509. call vclosewindow id
  510. signal go
  511. end
  512.  
  513. pickmorez:
  514.  
  515. call VDialogPos 50,40
  516. button = VFileBox('File to Include, Cancel After All Files Have Been Selected...', ''PICKdir'\*.*', 'file')
  517. if button = 'CANCEL' then signal ARCupex
  518. else
  519. filename = file.vstring
  520. call SysMkDir ''workdir''
  521. 'xcopy 'filename' 'workdir''
  522. signal pickmorez
  523.  
  524. ARCupex:
  525.  
  526. if Stream(''workdir'\*','C', 'Query Exists') = '' then signal go
  527. else
  528. call zipupexmsg
  529. NewDirectory = directory(''ARCdir'') 
  530. if ZIPLZH = pickzip then do
  531. ''ZIPPER' 'arcfile' 'workdir'\*'
  532. call vclosewindow id
  533. signal go
  534. end
  535. else do
  536. ''LZHER' 'arcfile' 'workdir'\*'
  537. call vclosewindow id
  538. signal go
  539. end
  540.  
  541. notziplzh:
  542.  
  543. ARCNAME = filespec('n',''arcfile'')
  544. fileext = right(ziplzh,3)
  545. parse upper var fileext fileext
  546. call VDialogPos 50, 35
  547. if chirp = y then call beep 2000,15
  548. msg.0 = 2
  549. msg.1 = '                       'ARCname' is not a 'fileext' archive !'
  550. msg.2 = '                            Press okay to continue...'
  551. call VMsgBox '                   ERROR !   ERROR !   ERROR !', msg, 1
  552. signal go
  553.  
  554. notarc:
  555.  
  556. ARCNAME = filespec('n',''arcfile'')
  557. call VDialogPos 50, 35
  558. if chirp = y then call beep 2000,15
  559. msg.0 = 2
  560. msg.1 = '                     'ARCname' is not an Archive File !'
  561. msg.2 = '                            Press okay to continue...'
  562. call VMsgBox '                      ERROR !   ERROR !   ERROR !', msg, 1
  563. signal go
  564.  
  565. nofiles:
  566.  
  567. call VDialogPos 50, 35
  568. if chirp = y then call beep 2000,15
  569. msg.0 = 2
  570. msg.1 = '                       There are no files in 'filesdirname' !'
  571. msg.2 = '                            Press okay to continue...'
  572. call VMsgBox '                      ERROR !   ERROR !   ERROR !', msg, 1
  573. signal go
  574.  
  575. printfile:
  576.  
  577. call VDialogPos 50, 35
  578. if chirp = y then call beep 2000,15
  579. msg.1 = '           Make sure printer is Powered Up and On Line !'
  580. msg.2 = '                               Press OK to continue...'
  581. msg.3 = '                               Press Cancel to abort...'
  582. button = VMsgBox('ˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇAttention!', msg, 3)
  583. if button = OK then do
  584. print '"'filename'"'
  585. drop action
  586. signal argchoice
  587. end
  588. else
  589. drop action
  590. signal argchoice
  591.  
  592. openmsg:
  593.  
  594. win.left   = 30
  595. win.right  = 70
  596. win.top    = 1
  597. win.bottom = 1
  598. id = VOpenWindow('Opening " 'arcfile' "', 'black', win)
  599. return
  600.  
  601. zipupmsg:
  602.  
  603. parse upper var archname archname
  604. win.left   = 35
  605. win.right  = 65
  606. win.top    = 1
  607. win.bottom = 1
  608. id = VOpenWindow('Creating " 'archname'.'arcfileext' "', 'black', win)
  609. return
  610.  
  611. zipupexmsg:
  612.  
  613. win.left   = 30
  614. win.right  = 70
  615. win.top    = 1
  616. win.bottom = 1
  617. id = VOpenWindow('Updating " 'arcfile' "', 'black', win)
  618. return
  619. CLEANUP:
  620.  
  621. win.left   = 34
  622. win.right  = 66
  623. win.top    = 1
  624. win.bottom = 1
  625. id = VOpenWindow('Thanks for using AFE... hmw', 'black', win)
  626. NewDirectory = directory(''workdrive'\')
  627. if Stream(''workdir'\*', 'c', 'query exists') <>'' then do
  628. call SysFileTree ''workdir'\*', 'files', 'fo'
  629. do i = 1 to files.0
  630. call sysfiledelete(files.i)
  631. end
  632. end
  633. call sysrmdir(''workdir'')
  634. call vclosewindow id
  635. call VExit
  636. exit
  637.